package com.arqui.admmon_module.client.core.main;

import com.gwtplatform.mvp.client.ViewImpl;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;

public class OptionView extends ViewImpl implements OptionPresenter.MyView {

	private final Widget widget;
	
	@UiField Button buttonBrand;
	@UiField Button buttonSystem;
	@UiField Button buttonEvents;
	@UiField HTMLPanel contentPanel;

	public interface Binder extends UiBinder<Widget, OptionView> {
	}

	@Inject
	public OptionView(final Binder binder) {
		widget = binder.createAndBindUi(this);
	}

	@Override
	public Widget asWidget() {
		return widget;
	}

	public Button getButtonBrand() {
		return buttonBrand;
	}

	public Button getButtonSystem() {
		return buttonSystem;
	}

	public HTMLPanel getContentPanel() {
		return contentPanel;
	}

	public Button getButtonEvents() {
		return buttonEvents;
	}

	public void setButtonEvents(Button buttonEvents) {
		this.buttonEvents = buttonEvents;
	}

	public void setButtonBrand(Button buttonBrand) {
		this.buttonBrand = buttonBrand;
	}

	public void setButtonSystem(Button buttonSystem) {
		this.buttonSystem = buttonSystem;
	}

	public void setContentPanel(HTMLPanel contentPanel) {
		this.contentPanel = contentPanel;
	}
	
	@Override
	public void setInSlot(Object slot, Widget content) {
		if(slot == OptionPresenter.SLOT_content){
			contentPanel.clear();
			
			if(content != null){
				contentPanel.add(content);
			}
		}else{
			super.setInSlot(slot, content);
		}
	}
}
